#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File   : d_io_file_directory.py
# @Email  : xuexia_xu@feidee.com
# @Time   : 2024/4/2 13:43
# @Desc   : 操作文件和目录
import os

print(os.name)
print(os.path.abspath('.'))

print(os.path.join('.', 'ttt'))
# os.mkdir(r'\BasicPython\Basic\testdir')

print(os.path.splitext(r'\BasicPython\Basic\test.txt'))
# 列出当前目录下的所有目录文件
list_dir = [x for x in os.listdir('.') if os.path.isdir(x)]
print(list_dir)

# 列出当前目录下的所有.py文件
list_file = [x for x in os.listdir('.') if os.path.isfile(x) and os.path.splitext(x)[1] == '.py']
print(list_file)
